<?php
include_once("player_repository.php");
$repPlayer= new PlayerRepository;
$fname=$_POST['fname'];
$sname=$_POST['sname'];
$email=$_POST['email'];


if(empty($fname)) {
    if(empty($sname)) {
       echo 'First name and Second name are empty';
	   header('LOCATION:'.$_SERVER["HTTP_REFERER"]);
    } else {
		echo 'First name is empty';
		header('LOCATION:'.$_SERVER["HTTP_REFERER"]);
     }
} else {
    if(empty($sname)) {
        echo 'Second name is empty';
		header('LOCATION:'.$_SERVER["HTTP_REFERER"]);
    } else {
        echo 'Record added';
$repPlayer->createPlayer($fname,$sname,$email);
	header('LOCATION:'.$_SERVER["HTTP_REFERER"]);
    }
}


?>